// 无参无返
function fn1(): void {}

// 无参有返
function fn2(): void {
    return undefined;
}
function fn3(): undefined {
    return undefined;
}
function fn4(): number {
    return 100;
}
function fn5(): string {
    return "qf_001";
}
function fn6(): { id: number; name: string } {
    return { id: 1, name: "张三" };
}
interface IFn7 {
    id: number;
    name: string;
}
function fn7(): IFn7 {
    return { id: 1, name: "张三" };
}
function fn8(): number[] {
    return [1, 2, 3];
}
function fn9(): Array<string> {
    return ["1", "2", "3"];
}

// 有参无返
function fn10(a: number, b: string): void {}

// 有参有返
function fn11(a: number, b: number): number {
    return a + b;
}

// const fn12: number = 100
// const fn12: string = "qf001";

const fn12: (a: number, b: number) => number = function (
    a: number,
    b: number
): number {
    return a + b;
};
const fn13: (a: number, b: number) => void = function (
    a: number,
    b: number
): void {};
const fn14: () => void = function (): void {};

// 1. 赋值式创建的一个普通函数
// const fn15 = function (a, b) { return a + b }

// 2. 将普通函数改造成 箭头函数
// const fn15 = (a, b) => { return a + b }

// 3. 利用箭头函数的语法, 简化我们的代码
// const fn15 = (a, b) => a + b;

// 4. 给函数的形参添加类型校验
// const fn15 = (a: number, b: number) => a + b;

// 5. 给函数的返回值添加类型校验
// const fn15 = (a: number, b: number): number => a + b;

// 6. 给变量添加一个类型校验
const fn15: (a: number, b: number) => number = (a: number, b: number): number => a + b;
